package com.rdc.example.dao;

import com.rdc.example.entity.User;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author Wookie,hypocodeemia
 * @description User实体类dao层接口
 */
public interface UserDao {

    /**
     * 用户登录
     *
     * @param userName 用户名
     * @param password 密码
     * @return 返回登录结果
     */
    boolean login(String userName, String password) throws Exception;

    /**
     * 插入用户数据
     *
     * @param user 用户
     * @return 返回插入结果
     */
    boolean insert(User user) throws Exception;

    boolean checkName(String name) throws Exception;



    /**
     *
     * @param user  用户
     * @return  返回更新结果
     */
    boolean update(User user) throws Exception;


    User getUserById(Integer id) throws Exception;

    User getUserByUserName(String userName) throws Exception;

    boolean updateUserType(Integer id, Integer type) throws Exception;

    boolean updateUserWallet(Integer userId, BigDecimal changeValue) throws Exception;

    boolean updateUserVipEndAt(Integer userId, LocalDateTime vipEndAt) throws Exception;

    /**
     * 查询所有用户
     *
     * @return 返回用户列表
     */
    List<User> listUser();

    Map<Integer, User> getUsersByIds(Set<Integer> userIds);

    List<User> searchUsersByUsername(String keyword, Integer pageBegin, Integer pageSize) throws Exception;

    Integer countSearchUsersByUsername(String keyword) throws Exception;
}
